<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
    <%@include file="/include/header.html" %>
    <script type="text/javascript" src="${ctx}/appjs/invoice/invoiceProxyStation.js"></script>
    <link rel="stylesheet" href="${ctx}/statics/css/update.css">
    <link rel="stylesheet" href="${ctx}/statics/css/common.css">
    <link rel="stylesheet" href="${ctx}/libjs/plugins/bootstrap-table-pagejump/bootstrap-table-pagejump.css">
    <script src="${ctx}/libjs/plugins/bootstrap-table-pagejump/bootstrap-table-pagejump.js"></script>
    <%--<link rel="stylesheet" href="${ctx}/libjs/plugins/laydate/skins/laydate.css">--%>
    <link rel="stylesheet" href="${ctx}/libjs/plugins/laydate/laydate.css">
    <script src="${ctx}/libjs/plugins/laydate/laydate.js"></script>
    <link rel="stylesheet" href="${ctx}/libjs/plugins/bootStrap-table-fixed-column/bootstrap-table-fixed-columns.css">
    <script src="${ctx}/libjs/plugins/bootStrap-table-fixed-column/bootstrap-table-fixed-columns.js"></script>
    <style>
        .bootstrap-table .fixed-table-container .table thead th .th-inner {
            text-align: center !important;
        }
    </style>
</head>

<script type="text/javascript">
    $('#topLink', window.parent.document).html(function (i, origText) {
        return '<ol class="breadcrumb">' +
            '<li class="breadcrumb-item">' +
            '<a href="">主页</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a>运营管理</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<strong>代开发票站点管理</strong>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a href="javascript:window.history.back()"><i class="fa fa-times"></i> 返回</a>' +
            '</li>' +
            '</ol>';
    });

    var has_add = '';
    var has_edit = '';
    var has_delete = '';
    var OperationsManagement_invoiceProxyStation_update = false;
    var OperationsManagement_invoiceProxyStation_look = false;
</script>

<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="col-sm-12">
        <div class="ibox">
            <div class="ibox-body">
                <div class="row">
                    <shiro:hasPermission name="OperationsManagement_invoiceProxyStation_reload">
                        <input id="stationNameSearch" name="stationNameSearch" type="text"
                               class="form-control shortInput"
                               placeholder="桩群名称">
                        <input id="beginTimeSearch" name="beginTimeSearch" type="text"
                               class="form-control shortInput input-distance"
                               placeholder="开始时间">
                        <input id="endTimeSearch" name="endTimeSearch" type="text"
                               class="form-control shortInput input-distance"
                               placeholder="结束时间">

                        <button class="btn btn-success input-distance" onclick="invoiceProxyStation.reLoad()">查询
                        </button>
                    </shiro:hasPermission>
                    <shiro:hasPermission name="OperationsManagement_invoiceProxyStation_add">
                        <button type="button" class="btn  btn-success marginLeft-auto"
                                onclick="invoiceProxyStation.showModel()">
                            新增代开
                        </button>
                    </shiro:hasPermission>
                </div>
                <table id="exampleTable" data-mobile-responsive="true">
                </table>


                <%--  增加代开站点模态框  --%>
                <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog"
                     aria-labelledby="exampleModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                        aria-hidden="true"></span></button>
                                <h4 class="modal-title" id="exampleModalLabel" data-dismiss="modal" aria-label="Close">
                                    关闭</h4>
                            </div>
                            <div class="modal-body">
                                <form id="contentForm">
                                    <div class="form-group row">
                                        <label class="col-sm-4 col-form-label text-right">充电站名称*:</label>
                                        <div class="col-sm-8">
                                            <select class="form-control" id="elecStationId" name="elecStationId"
                                                    style="display: block !important;">
                                                <option value="">充电站名称</option>
                                                <c:forEach items="${elecStations}" var="elecStation">
                                                    <option value="${elecStation.elecStationId}">${elecStation.stationName}</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                <button type="button" class="btn btn-success" id="addInvoiceProxyStation">确认</button>
                            </div>
                        </div>
                    </div>
                </div>


                <%--  开票账号设置模态框  --%>
                <div class="modal fade" id="accountSettingModal" tabindex="-1" role="dialog"
                     aria-labelledby="exampleModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                        aria-hidden="true"></span></button>
                                <h4 class="modal-title" data-dismiss="modal" aria-label="Close">
                                    关闭</h4>
                            </div>
                            <div class="modal-body">

                                <div class="form-group row">
                                    <form id="accountSettingForm" class="layui-form">
                                        <div class="col-sm-12">
                                            <input type="radio" class="form-control" name="tenantType" checked
                                                   lay-filter="tenantType"
                                                   title="本运营商" value="0">
                                        </div>
                                        <div class="">
                                            <input type="radio" class="form-control" name="tenantType"
                                                   lay-filter="tenantType" title="分销商" value="1">
                                        </div>
                                    </form>
                                    <div class="" style="margin-left: 30px;margin-top: 40px">
                                        <select class="form-control" id="tenantOperatorCode" style="display: none">
                                        </select>
                                    </div>
                                </div>

                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                <button type="button" class="btn btn-success" id="saveAccountSetting">确认</button>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
<shiro:hasPermission name="OperationsManagement_invoiceProxyStation_update">
    <script>
        OperationsManagement_invoiceProxyStation_update = true;
    </script>
</shiro:hasPermission>
<shiro:hasPermission name="OperationsManagement_invoiceProxyStation_look">
    <script>
        OperationsManagement_invoiceProxyStation_look = true;
    </script>
</shiro:hasPermission>
<script type="text/javascript">

    $(function () {
        $('#elecStationId').searchableSelect();
    })

    layui.use(['form', 'jquery', 'tree', 'laydate', 'util'], function () {
        var form = layui.form;
        var $ = layui.jquery;
        //运营商切换
        //统一互联与分开互联切换
        form.on("radio(tenantType)", function (data) {
            if ($(this).val() == "0") {
                $("#accountSettingModal .searchable-select").addClass("hide");
            } else {
                $("#accountSettingModal .searchable-select").removeClass("hide");
                // $("#tenantOperatorCode + div").remove()
                // $('#tenantOperatorCode').searchableSelect();
            }
        });
    })


    // //日期范围限制
    var start = {
        elem: '#beginTimeSearch',
        format: 'YYYY-MM-DD hh:mm:ss',
        // theme: '#3195f0',
        // min: laydate.now(), //设定最小日期为当前日期
        // max: '2099-06-16 23:59:59', //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            $("#endTime").val("")
            end.min = datas
        }
    };
    var end = {
        elem: '#endTimeSearch',
        format: 'YYYY-MM-DD hh:mm:ss',
        // theme: '#3195f0',
        // min: laydate.now(),
        // max: '2099-06-16 23:59:59',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
    laydate.skin('molv');//皮肤

    invoiceProxyStation.init();
</script>
</body>

</html>
